package com.bw.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;

import com.bw.bean.Classes;
import com.bw.bean.Teachers;
import com.bw.service.ClassesService;
@ControllerAdvice
public class PublicController {
	@Autowired
	private ClassesService classesServiceImpl;
	@ModelAttribute("classList")
	public List<Classes> getAllClass(){
		List<Classes> list = classesServiceImpl.list();
		return list;
	}
	@ModelAttribute("teacher")
	public Teachers teacher(HttpServletRequest request){
		return (Teachers)request.getSession().getAttribute("teacher");
	}
}
